// 导入封装好的网络请求类工具
import Network from './network'
import uploadPhoto from './uploadPhoto';
import applicationJson from './applicationJson';
import qs from 'qs';

// 封装各种接口请求

// export const 接口名 = () => Network.get('/路由',参数对象);
export const userLogin = (data) => Network.post('/api/login', {
  data
})
export const getRoleList = () => Network.get(`/api/role/getRoleList`)


export const getAllCount = () => Network.get('/api/order/payment/allCount', {}) //近七日总额
export const getTodayTotalOrder = () =>
  Network.get('/api/order/payment/todayCount', {}) //今日订单总数
export const getYesturdayTotalOrder = () =>
  Network.get('/api/order/payment/yesterdayCount', {}) //昨日订单总数
export const getDepositToPay = () => Network.get('/api/order/status/1', {}) //待支付押金数
export const getBaseInfo = () => Network.get('/api/order/status/2', {}) //基本资料订单
export const getConfirmOrder = () => Network.get('/api/order/status/6', {}) //确认订单

export const getRecordList = () =>
  Network.get('/api/loginRecord/getRecordList', {}) //分页获取登录日志

export const getRecordListUser = (current, size, userId) =>
  Network.get(`/api/loginRecord/getRecordList/${userId}?current=${current}&size=${size}`, {
    userId,
  }) //分页获取单个用户登录日志

export const getStudentList = (current, size, username, nickname, createTime) =>
  Network.get('/api/student/getStudentList', {
    current,
    size,
    username,
    nickname,
    createTime
  }) //获取学生列表(管理员)

export const getStudentListByid = (current, size, username, nickname, createTime, consultantId) =>
  Network.get(`/api/student/getStudentListByid/${consultantId}`, {
    current,
    size,
    username,
    nickname,
    createTime,
    consultantId
  }) //获取学生列表(顾问)

export const deleteStudentByid = (userId) =>
  Network.ParamsPost(`/api/student/${userId}/delete`, {
    userId
  }) //删除单个学生

export const getConsultant = (current, size, inquire) =>
  Network.get(`/api/student/getConsultant`, {
    current,
    size,
    inquire
  }) //获取顾问列表

export const updateConsultantById = (userId, consultantId) =>
  Network.ParamsPost(`/api/student/updateConsultantById`, {
    userId,
    consultantId
  }) //更新学生订单顾问分配

export const disableStudent = (userId) =>
  Network.ParamsPost(`/api/student/${userId}/disable`, {
    userId
  }) //禁用单个学生账号

export const updateStudent = (freeCheck, userId) =>
  Network.ParamsPost(`/api/student/${userId}/update`, {
    freeCheck,
    userId
  }) //更新学生信息 前端把用户名设置不能修改

export const getPlanMajor = (current, size, schoolName, majorName, years, m1, m2) => Network.get('/api/plan/planMajor', {
  current,
  size,
  schoolName,
  majorName,
  years,
  m1,
  m2
}) //获取方案查询数据列表

export const getStudentLogin = (current, size) =>
  Network.get('/api/student/getStudentLogin', {
    current,
    size
  }) //获取学生登录日志

export const getAllSchool = (current, size) =>
  Network.get(`/api/school/allSchool`, {
    current,
    size,
  }) //获取学校列表(默认数据为第一页10行)

export const getSchoolList = (name, current, size) =>
  Network.get(`/api/school/querySchoolListName`, {
    name,
    current,
    size,
  }) //查询学校列表

export const deleteSchool = (schoolId) =>
  Network.get(`/api/school/deleteSchool/${schoolId}`, {
    schoolId
  }) //删除学校

export const deleteMajor = (mid) =>
  Network.get(`/api/major/deleteMajor/${mid}`, {
    mid
  }) //删除专业

export const getSchoolInfo = (schoolId) =>
  Network.get(`/api/school/schoolInfo/${schoolId}`, {}) //获取单个学校信息

export const getSchoolApplyInfo = (schoolId) =>
  Network.get(`/api/school/require/${schoolId}`, {

  }) //获取单个学校申请信息

export const addSchoolInfo = (data) =>
  Network.post(`/api/school/insertSchoolNew`, {
    data
  }) //添加单个学校信息


export const addSchoolApplyInfo = (schoolId, data) =>
  Network.post(`/api/school/insertRequirementArray/${schoolId}`, {
    data
  }) //添加单个学校申请信息

export const addSchoolPhoto = (data) =>
  uploadPhoto({
    url: "/api/school/insertSchoolLogo",
    method: "post",
    data
  }) //添加单个学校图片信息

export const updateSchoolInfo = (data) =>
  Network.post(`/api/school/updateSchoolNew`, {
    data
  }) //更新学校信息(除了申请信息)

export const updateSchoolApplyInfo = (schoolId, data) =>
  Network.post(`/api/school/updateRequirement/${schoolId}`, {
    data
  }) //更新学校信息(除了申请信息)



export const getSchool = (current, size, school, m1, m2) =>
  Network.get(`/api/school/nameSchool`, {
    current,
    size,
    school,
    m1,
    m2
  }) //获取搜索后的学校列表(默认数据为第一页10行)

export const getStudentOrderList = (current, size, userId) =>
  Network.get(`/api/student/getOrderList/${userId}?current=${current}&size=${size}`, {
    userId
  }) //获取对应用户ID的学习的订单记录,数据后缀/1000004?current=1&size=12

// export const getStudentOrderList = (current,size,userId) =>
//   Network.get(`/api/student/getOrderList`, {
//     current,size,userId,
//   }) //无法获取对应用户ID的学习的订单记录(Error: Request failed with status code 404) 

export const getStudentDetail = (userId) =>
  Network.get(`/api/student/getStudentById/${userId}`, {
    userId,
  }) //获取单个学生的信息

export const updateStudentDetail = (userId, data) =>
  Network.post(`/api/student/${userId}/update`, {
    data
  }) //更新单个学生的信息(除了头像)

export const updateStudentPhotoDetail = (userId, data) =>
  uploadPhoto({
    url: `/api/student/${userId}/update`,
    method: "post",
    data: data
  }) //更新单个学生的头像信息

export const getCMajor = (current, size) =>
  Network.get(`/api/c/major`, {
    current,
    size,
  }) //获取国内学校专业列表

export const getAllSubject = (current, size) =>
  Network.get(`/api/major/allMajor`, {
    current,
    size,
  }) //获取专业列表
// export const getOrderList = (currentpage, size,   orderType   ) =>
// Network.get('/api/order/getOrderList', {
//   currentpage, size, orderType 
// })  //分页获取订单列表
export const getMajor = (schoolId, name, current, size) =>
  Network.get(`/api/major/likeMajor`, {
    schoolId,
    name,
    current,
    size,
  }) //获取搜索后的专业列表

export const getlikeMajor = (schoolId, name, current, size) =>
  Network.get(`/api/c/major/likeMajor`, {
    schoolId,
    name,
    current,
    size,
  }) //获取搜索后的国内学校和专业列表

export const getOrderList = (current, size, orderUserId, namePhone, createTime, orderSource, orderType, statusId) =>
  Network.get('/api/order/getOrderList', {
    current,
    size,
    orderUserId,
    namePhone,
    createTime,
    orderSource,
    orderType,
    statusId
  }) //分页获取订单列表

export const getAllMajor = (current, size) =>
  Network.get(`/api/c/major/allMajor`, {
    current,
    size,
  }) //分页查询全部专业信息

export const addSubjectInfo = (data) =>
  Network.post(`/api/major/insertMajor`, {
    data
  }) //添加某个专业详细信息

export const getSubjectInfo = (mid) =>
  Network.get(`/api/major/majorInfo/${mid}`, {
    mid
  }) //获取某个专业详细信息

export const updateMajor = (data) =>
  Network.post(`/api/major/updateMajor`, {
    data
  }) //更新某个专业详细信息

export const getOrderExpiration = () =>
  Network.get(`/api/order/expiration/getExpiration`, {}) //获取订单过期时长

export const setOrderExpiration = (time) =>
  Network.ParamsPost(`/api/order/expiration/update`, {
    time
  }) //设置订单过期时长

export const getSearchMajor = (schoolName, name, current, size) =>
  Network.get(`/api/c/major/nameMajor`, {
    schoolName,
    name,
    current,
    size,
  }) //分页查询国内学校和专业列表

export const getOrderByid = (orderId) =>
  Network.get(`/api/order/getOrderByid/${orderId}`, {
    orderId
  }) //获取单个订单信息

export const getUserList = (current, size, username, phone) =>
  Network.get('/api/user/getUserList', {
    current,
    size,
    username,
    phone
  }) //分页获取用户列表

export const deleteUser = (userId) =>
  Network.ParamsPost(`/api/user/${userId}/delete`, {
    userId
  }) //删除单个用户

export const disableUser = (userId) =>
  Network.ParamsPost(`/api/user/${userId}/disable`, {
    userId
  }) //禁用/取消禁用单个用户

export const getRecommenderInfo = (orderId) =>
  Network.get(`/api/order/reference/referenceInfo/${orderId}`, {
    orderId
  }) // 获取推荐人信息

export const getExperienceInfo = (orderId) =>
  Network.get(`/api/order/other/orderJobInfo/${orderId}`, {
    orderId
  }) // 其他信息-实习经历

export const getActivityInfo = (orderId) =>
  Network.get(`/api/order/other/orderActiveInfo/${orderId}`, {
    orderId
  }) // 其他信息-活动

export const getSkillInfo = (orderId) =>
  Network.get(`/api/order/other/orderSkillInfo/${orderId}`, {
    orderId
  }) // 其他信息-技能

export const getPrizeInfo = (orderId) =>
  Network.get(`/api/order/other/orderPrizeInfo/${orderId}`, {
    orderId
  }) // 其他信息-奖项
export const getPaperInfo = (orderId) =>
  Network.get(`/api/order/other/orderPaperInfo/${orderId}`, {
    orderId
  }) // 其他信息-论文

export const getEducationInfo = (orderId) =>
  Network.get(`/api/order/education/educationInfo/${orderId}`, {
    orderId
  }) // 教育信息模块

export const getOrderBaseInfo = (orderId) =>
  Network.get(`/api/order/info/getInfoByid/${orderId}`, {
    orderId
  }) // 订单用户基本信息

export const getChoiceByid = (orderId) =>
  Network.get(`/api/order/choice/getChoiceByid/${orderId}`, {
    orderId
  }) // 申请择校信息
// export const updateSchoolChoiceInfo = (orderId,data) => 
// Network.post(`/api/order/choice/${orderId}/update`, {
//   data
// }) // 更新申请择校信息

// export const updateSchoolChoiceInfo = (orderId,majorId) => 
//   Network.post(`/api/order/choice/${orderId}/update?majorId=${majorId}`, {
//     majorId
//   }) // 更新申请择校信息

export const updateSchoolChoiceInfo = (orderId, majorId, cMajorId) =>
  Network.ParamsPost(`/api/order/choice/${orderId}/update`, {
    majorId,
    cMajorId
  }) // 更新申请择校信息
export const updateUserBaseInfo = (orderId, data) =>
  Network.post(`/api/order/info/${orderId}/update`, {
    data
  }) // 更新第二个基本信息
// export const updateUserBaseInfo = (address, birth, birthPlace, email, firstName, gender, lastName, marriage, name, nationality,
//     orderId, passport, phone) =>
//   Network.post(`/api/order/info/${orderId}/update`, {
//     address,
//     birth,
//     birthPlace,
//     email,
//     firstName,
//     gender,
//     lastName,
//     marriage,
//     name,
//     nationality,
//     passport,
//     phone
//   }) // 更新第二个基本信息

// export const updateEducationInfo = (eid, endTime, exchangeExperience, exchangeSchoolName, grape, orderId,
//     schoolGpa, schoolMajor, schoolName, startTime) =>
//   Network.ParamsPost(`/api/order/education/updateEducationInfo`, {
//     eid,
//     endTime,
//     exchangeExperience,
//     exchangeSchoolName,
//     grape,
//     orderId,
//     schoolGpa,
//     schoolMajor,
//     schoolName,
//     startTime
//   }) // 更新教育信息

export const updateEducationInfo = (data) =>
  Network.post(`/api/order/education/updateEducationInfo`, {
    data
  }) // 更新教育信息

export const updateOrderJob = (describes, endTime, jobAddress, jobCompany, jobId, jobName, orderId, startTime) =>
  Network.ParamsPost(`/api/order/other/updateOrderJob`, {
    describes,
    endTime,
    jobAddress,
    jobCompany,
    jobId,
    jobName,
    orderId,
    startTime
  }) // 更新实习经历

export const updateOrderActive = (activeId, activeName, describes, endTime, orderId, startTime) =>
  Network.ParamsPost(`/api/order/other/updateOrderActive`, {
    activeId,
    activeName,
    describes,
    endTime,
    orderId,
    startTime
  }) // 更新活动

export const updataOrderMatch = (describes, matchId, matchName, orderId) =>
  Network.ParamsPost(`/api/order/other/updataOrderMatch`, {
    describes,
    matchId,
    matchName,
    orderId
  }) // 更新比赛信息

export const updataOrderPaper = (orderId, paperAuthor, paperId, paperName, paperPublication, paperTime) =>
  Network.ParamsPost(`/api/order/other/updateOrderPaper`, {
    orderId,
    paperAuthor,
    paperId,
    paperName,
    paperPublication,
    paperTime
  }) // 更新论文信息

export const updataOrderPrize = (orderId, prizeId, prizeName, time) =>
  Network.ParamsPost(`/api/order/other/updateOrderPrize`, {
    orderId,
    prizeId,
    prizeName,
    time
  }) // 更新奖项信息

export const updataOrderSkill = (skillList, orderId) =>
  Network.ParamsPost(`/api/order/other/updateOrderSkill`, {
    skillList,
    orderId
  }) // 更新技能

export const updateReference = (address, email, orderId, phone, referenceCourse, referenceId,
    referenceJob, referenceName, referenceRelationship, unit) =>
  Network.ParamsPost(`/api/order/reference/updateReference`, {
    address,
    email,
    orderId,
    phone,
    referenceCourse,
    referenceId,
    referenceJob,
    referenceName,
    referenceRelationship,
    unit
  }) // 更新推荐人信息

export const getApply = (orderId) => Network.get(`/api/order/apply/getApply/${orderId}`, {}) //获取用户申请进度信息

export const uploadApplyPhotoInfo = (orderId, data) =>
  uploadPhoto({
    url: `/api/order/apply/uploadInfo/${orderId}`,
    method: "post",
    data
  }) //上传更新申请进度图片信息

export const uploadApplyStatusInfo = (orderId, statusId) =>
  Network.ParamsPost(`/api/order/apply/uploadInfo/${orderId}`, {
    statusId
  }) //上传更新申请进度状态信息

// export const uploadApplyInfo = (orderId, statusId, files) =>
//   Network.post(`/api/order/apply/uploadInfo/${orderId}`, {
//     statusId,
//     files
//   })



//获取单个用户信息
export const getUserInfo = (userId) => Network.get(`/api/user/getUserById/${userId}`, {})

//添加用户
export const AddUser = (data) =>
  // applicationJson({
  //   url: `/api/user/createUser`,
  //   method: "post",
  //   data
  // })
  Network.post(`/api/user/createUser`, {
    data
  })

//编辑用户(除了图片)
export const EditUser = (userId, data) =>
  // applicationJson({
  //   url: `/api/user/${userId}/update`,
  //   method: "post",
  //   data
  // })
  Network.post(`/api/user/${userId}/update`, {
    data
  })

// 更新平台图片信息
export const updateUserInfoPhoto = (userId, data) =>
  uploadPhoto({
    url: `/api/user/${userId}/update`,
    method: "post",
    data
  })

//更新平台信息(除了图片)
export const updateInfo = (data) =>
  Network.post('/api/platform/updateInfo', {
    data
  })

// 更新平台图片信息
export const updateInfoPhoto = (data) =>
  uploadPhoto({
    url: "/api/platform/updateInfo",
    method: "post",
    data
  })

//获取平台信息
export const getInfo = () => Network.get('/api/platform/getInfo', {})